source("scripts/myRLib.R")
xt <- read.table("output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xt.assoc.logistic",
header = T)
xt$SNP <- as.character(xt$SNP)
xt <- xt[order(xt$SNP), ]
yi <- read.table("output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/yi.logistic.assoc",
header = T)
xtyi.files <- strsplit("output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p1.0000e+00.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p3.0000e-01.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p1.0000e-01.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p3.0000e-02.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p1.0000e-02.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p3.0000e-03.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p1.0000e-03.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p3.0000e-04.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p1.0000e-04.assoc.logistic",
":")[[1]]
ps <- strsplit("1:0.3:0.1:0.03:0.01:0.003:0.001:0.0003:0.0001",
":")[[1]]
for (i in 1:length(xtyi.files)) {
xtyi <- read.table(xtyi.files[i], header = T)
xtyi$SNP <- as.character(xtyi$SNP)
xtyi <- xtyi[order(xtyi$SNP), ]
p <- ps[i]
cat("##", "Cutoff =", p, "\n")
cat("\n")
cat("\n")
cat("Filename is", as.character(yi[i, 1]))
cat("\n")
pander(yi[i, 2:ncol(yi)])
qqplot(-log10((1:length(xt$P))/length(xt$P)), -log10(xt$P),
main = "QQplot - Gi: Y ~ Gi", xlab = "-log10 expected pval",
ylab = "-log10 observed pval")
abline(a = 0, b = 1, col = "red")
qqplot(-log10((1:length(xtyi[xtyi$TEST == "ADD", "P"]))/length(xtyi[xtyi$TEST ==
"ADD", "P"])), -log10(xtyi[xtyi$TEST == "ADD", "P"]),
main = "QQplot - Gi: Y ~ Gi + I", xlab = "-log10 expected pval",
ylab = "-log10 observed pval")
abline(a = 0, b = 1, col = "red")
hist(log(xtyi[xtyi$TEST == "PRS", "OR"]), main = "Hist - I: Y ~ Gi + I",
xlab = "OR")
abline(v = yi[i, "prs.estmate"], col = "red")
abline(v = yi[i, "prs.estmate"] - yi[i, "prs.std"], col = "red")
abline(v = yi[i, "prs.estmate"] + yi[i, "prs.std"], col = "red")
plot(xt$P, xtyi[xtyi$TEST == "ADD", "P"], main = "P-value of Gi: Gi + I vs Gi",
xlab = "Gi", ylab = "Gi + I")
cat("\n")
cat("\n")
}
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p1.0000e+00.txt
| intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|
| -0.5418 | 0.03137 | 8.018e-67 | 0.04412 | 0.01577 | 0.005155 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p3.0000e-01.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 2 | -0.5656 | 0.03476 | 1.633e-59 | 0.03532 | 0.01284 | 0.005935 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p1.0000e-01.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 3 | -0.5531 | 0.03344 | 1.993e-61 | 0.02671 | 0.01108 | 0.01594 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p3.0000e-02.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 4 | -0.5846 | 0.04352 | 3.835e-41 | 0.02307 | 0.01096 | 0.0354 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p1.0000e-02.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 5 | -0.6643 | 0.06546 | 3.349e-24 | 0.02777 | 0.01106 | 0.012 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p3.0000e-03.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 6 | -0.6481 | 0.06936 | 9.291e-21 | 0.02437 | 0.01176 | 0.03823 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p1.0000e-03.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 7 | -0.6485 | 0.07401 | 1.927e-18 | 0.0237 | 0.01235 | 0.055 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p3.0000e-04.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 8 | -0.6515 | 0.08246 | 2.761e-15 | 0.02208 | 0.01277 | 0.08387 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p1.0000e-04.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 9 | -0.6468 | 0.08097 | 1.37e-15 | 0.02247 | 0.0132 | 0.08867 |